Skip to content

PEP 748: tlslib - configuration#4958

Open
Julien00859 wants to merge 5 commits into
python:mainfrom
Julien00859:Julien00859/tlslib-config
Open

PEP 748: tlslib - configuration#4958
Julien00859 wants to merge 5 commits into
python:mainfrom
Julien00859:Julien00859/tlslib-config

Conversation

@Julien00859
Copy link
Copy Markdown

First time contributor 🎉

A few suggestions to make the configuration a bit more explicit. I decided to leave most of the attributes undocumented as they are pretty explicit to me, and to instead only document the few attributes that are different from the client and the server.

PEP 748: ConfigurationError is only for unsupported features

Discussed at trailofbits/tlslib.py#72 (comment)

ConfigurationError was intended for when specific implementations don't support certain behavior (e.g. adding a certificate by identifier). I think ValueError should be fine, probably raised when validating the configuration. ~Joop

PEP 748: certificate_chain is mandatory server-side

Discussed at https://discuss.python.org/t/pre-pep-discussion-revival-of-pep-543-a-unified-tls-api-for-python/51263/75

This makes sense to me. We can allow empty server certificates in the insecure module. ~Joop

PEP 748: disambiguate config trust_store=None

Discussed at https://discuss.python.org/t/pre-pep-discussion-revival-of-pep-543-a-unified-tls-api-for-python/51263/78

I agree, this is better. ~Joop

Ease reading the diff of the next commits.
Client-side `trust_store=None` means `TrustStore.system()` but
server-side it means "skip client authentication". One could think it
means "skip server authentication" when used client-side, so let's not
support `None` at all client-side and instead default to
`TrustStore.system()`.
@Julien00859 Julien00859 requested a review from ncoghlan as a code owner May 6, 2026 22:03
@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented May 6, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 6, 2026

Documentation build overview

📚 pep-previews | 🛠️ Build #32662161 | 📁 Comparing 89e8de4 against latest (c093d5f)

  🔍 Preview build  

709 files changed · ± 709 modified

± Modified

@hugovk hugovk changed the title PEP748 tlslib - configuration PEP 748: tlslib - configuration May 8, 2026
@hugovk
Copy link
Copy Markdown
Member

hugovk commented May 8, 2026

cc PEP authors @jvdprng and @woodruffw.

Copy link
Copy Markdown

@jvdprng jvdprng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I left two suggestions.

Comment thread peps/pep-0748.rst
Comment thread peps/pep-0748.rst Outdated
Copy link
Copy Markdown

@jvdprng jvdprng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, there is one additional thing we should change.

Comment thread peps/pep-0748.rst
lowest_supported_version: TLSVersion | None = None,
highest_supported_version: TLSVersion | None = None,
trust_store: TrustStore | None = None,
trust_store: TrustStore = TrustStore.system(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember now why we had None here before: we wanted to avoid creating a shared default object in the API which should be immutable/comparable. So I think we need something else here:

  • A sentinel object (we deliberately chose not to do this IIRC)
  • Do not define the default, and specify that a missing TrustStore should default to the system trust store. This is my preference.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not define the default, and specify that a missing TrustStore should default to the system trust store. This is my preference.

I don't understand, can you add an example?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We wanted to avoid creating a shared default object in the API which should be immutable/comparable.

I think there is room for a TrustStore.is_system(truststore) method.

Comment thread peps/pep-0748.rst Outdated
@Julien00859 Julien00859 force-pushed the Julien00859/tlslib-config branch 2 times, most recently from adfecae to e14904b Compare May 12, 2026 20:10
TLS 1.3 and secure TLS 1.2 both require a certificate and private key
server-side. Making the parameter mandatory makes it explicit that one
is required. It still is optional client-side.
@Julien00859 Julien00859 force-pushed the Julien00859/tlslib-config branch from e14904b to 89e8de4 Compare May 12, 2026 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants